package sunyu.demo.spring.activemq;

import org.slf4j.Logger;
import sunyu.toolkit.core.LogKit;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * @author 孙宇
 */
public class TopicMessageListener implements MessageListener {

    private static final Logger logger = LogKit.getLogger();

    @Override
    public void onMessage(Message message) {
        TextMessage msg = (TextMessage) message;
        try {
            logger.debug("{}", msg.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
